﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Bosphorus.Migrator.Dialect.Core;
using Bosphorus.Migrator.Implementation.MigrationCommand;
using Bosphorus.Migrator.Model;
using Bosphorus.Migrator.Core.MigrationCommand;
using Bosphorus.Migrator.Implementation.CommandProcessor;
using Castle.Windsor;

namespace Bosphorus.Migrator.Dialect.DummyImplementation
{
    public class TableDialect : AbstractDialect<AbstractCommand<Table>>
    {
        //AKLIMA GELENLER...
        //Burda NVelocity kullanılabilir mi??
        //Çok şık bişey olabilir...
        public override string Create(AbstractCommand<Table> command)
        {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.AppendFormat("CREATE TABLE [{0}] (", command.Model.Name);
            stringBuilder.AppendLine();

            string columns = DialectedGenerator.Instance.Process(command.SubCommands);
            stringBuilder.Append(columns);
            stringBuilder.AppendLine(")");

            return stringBuilder.ToString();
        }

        public override string Alter(AbstractCommand<Table> command)
        {
            //string command = string.Format("Alter Table {0}", model.Name);
            //return command;
            return string.Empty;
        }

        public override string Drop(AbstractCommand<Table> command)
        {
            string commandStrging = string.Format("DROP TABLE {0}", command.Model.Name);
            return commandStrging;
        }
    }
}
